package com.ng.servive.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ng.common.service.CacheServiceImpl;
import com.ng.dao.CjfxBaseDao;
import com.ng.dao.cjfxyeardao;
import com.ng.entity.CJFDBASEYEAR;

import com.ng.entity.CJFXBASEINFO;
import com.ng.servive.cjfxyearService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author cb
 * @Description TODO
 * @date 2023/3/23
 */
@Service
public class cjfxyearServiceImpl extends ServiceImpl<cjfxyeardao,CJFDBASEYEAR>  implements cjfxyearService
{

    @Override
    public List<CJFDBASEYEAR> getyearbypykm(CJFDBASEYEAR cjfdbaseyearinfo) {
        String  pykm=cjfdbaseyearinfo.getPykm();
        String  year=cjfdbaseyearinfo.getCyear();
        QueryWrapper<CJFDBASEYEAR>queryWrapper=new QueryWrapper<CJFDBASEYEAR>();
        queryWrapper.eq(StringUtils.isNotBlank(pykm),"pykm",pykm);
        queryWrapper.eq(StringUtils.isNotBlank(year),"cyear",year);
        return   this.baseMapper.selectList(queryWrapper);

    }

    public List<CJFDBASEYEAR>Getyears(String pykm){
        QueryWrapper<CJFDBASEYEAR>queryWrapper=new QueryWrapper<CJFDBASEYEAR>();
        queryWrapper.select("cyear").eq("pykm",pykm).groupBy("cyear").orderByDesc("cyear");
        return   this.baseMapper.selectList(queryWrapper);
    }
}
